package com.dongdongshop.controller;

import com.dongdongshop.data.Result;
import com.dongdongshop.pojo.TbContent;
import com.dongdongshop.service.ContentService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@RequestMapping("content")
@Controller
public class ContentController {
    @DubboReference
    private ContentService contentService;

    @RequestMapping("/listContentsByCateId")
    @ResponseBody
    public Result listContentsByCateId1(Long cateId){
        try {
            List<TbContent> list = contentService.listContentsByCateId(cateId);
            return Result.OK().setData(list);
        }catch (Exception e){
            return Result.ER();
        }
    }
}
